package com.example.demo.repository;

import com.example.demo.model.Item;
import org.apache.ibatis.annotations.*;

@Mapper
public interface ItemModel {

    @Insert("INSERT INTO `t_items` (`name`, `item`) VALUE (#{name}, #{item})")
    void insertItem(Item item);

    @Delete("DELETE FROM `t_items` WHERE `name`=#{name} LIMIT 1")
    void deleteItemByName(@Param("name") String name);

    @Update("UPDATE `t_items` SET `item`=#{item} WHERE `name`=#{name} LIMIT 1")
    void updateItemByName(@Param("name") String name, @Param("item") String item);

    @Select("SELECT `name`, `item` FROM `t_items` WHERE `name`=#{name} LIMIT 1")
    Item selectItemByName(@Param("name") String name);
}
